#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QDate>
#include <QMenu>
#include <QMessageBox>
#include <QSystemTrayIcon>
#include <QtNetwork/QLocalSocket>
#include <QLocalServer>
#include <QLocalSocket>
#include <QTimer>
#include <QFileDialog>
#include <QFile>
#include <QSettings>

#include "dbOperate/sqliteoperate.h"
#include "dbOperate/dbPrescription.h"
#include "advanced/Form_advancedStatistics.h"

namespace Ui {
class MainWindow;
}


class MainWindow : public QMainWindow
{
	Q_OBJECT
private:
	sqliteOperate sl;
	dbPrescription dp;
	QList<record_t> records;
	QList<default_list_t> lists;
	QMenu menu, trayMenu;
	QSystemTrayIcon *system_tray;

	QString group;
	bool detial;
	QLocalServer* m_localServer;
	QSettings settings;
public:
	explicit MainWindow(QWidget *parent = 0);
	~MainWindow();
	void refreshRecordTable();
	void refreshRecordTable(QString group);
	void refreshComboboxList();
	void initSystemTray();
	void initInterface();
	bool initUniqueInstance();

	void backupDB();

private:
	void closeEvent(QCloseEvent *event);

private slots:
	void newLocalSocketConnection();

	void on_pushButton_test_clicked();

	void on_pushButton_addNew_clicked();
	void delete_record();
	void on_actionaddOptions_triggered();

	void on_tableWidget_prescriptionList_customContextMenuRequested(const QPoint &pos);

	void on_actioncontactMe_triggered();

	void on_comboBox_name_currentTextChanged(const QString &arg1);

	void on_pushButton_lookUpThisMonth_clicked();

	void on_pushButton_lookUpThisYear_clicked();

	void on_pushButton_lookUpAll_clicked();

	void on_pushButton_advance_clicked();

	void on_pushButton_lookUpToday_clicked();

	void on_checkBox_deital_stateChanged(int arg1);

	void on_actionexportCSV_triggered();

private:
	Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
